package com.zrkizzy.seckill.service.core.impl;

import com.zrkizzy.seckill.entity.Goods;
import com.zrkizzy.seckill.mapper.GoodsMapper;
import com.zrkizzy.seckill.service.core.IGoodsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zrkizzy.seckill.vo.system.GoodsVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 商品表 服务实现类
 * </p>
 *
 * @author zhangrongkang
 * @since 2023-03-22
 */
@Service
public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements IGoodsService {

    @Autowired
    private GoodsMapper goodsMapper;

    /**
     * 获取商品列表
     *
     * @return 商品返回对象集合
     */
    @Override
    public List<GoodsVO> listGoods() {
        return goodsMapper.listGoods();
    }

    /**
     * 通过商品ID获取对应商品
     *
     * @param goodsId 商品ID
     * @return 商品前端返回对象
     */
    @Override
    public GoodsVO getGoodsById(Long goodsId) {
        return goodsMapper.getGoodsById(goodsId);
    }
}
